<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>&nbsp;boxphp后台管理系统</title>
<include file="Public/header" />
<script type="text/javascript" src="__PUBLIC__/Js/jquery.validate.js"></script>
</head>


<body>
<div>
   
   
        <div class="list_vmall_man">
        	<div class="list_vmall_le">
        
              <include file="./Apps/BoxAdmin/View/Public/adminMenu.html" />
               
            </div>
            <div class="list_vmall_rig">
            	<ul class="breadcrumb">
                    <li class="active">运费设置</li>
                </ul>
                <div class="list_vmall_bort">
                    <form id="myform" method="post" action="<{:U('freight')}>">
					<input type="hidden" name="store_id" value="1" />
		<div style="padding:10px;"> <h3>默认运费：<input type="text" name="config[df]" value="<{$feeconfig['df']}>"  maxlength="25" /></h3></div>
	
		<div style="padding:10px;"> <h3>重量</h3></div>
	<div class="vmall_cle" style="margin-left:30px;" >
		<table width="600" style="line-height:30px;">
		<tr><td height="24" colspan="2">重量区间(kg)</td><td height="24">运费(元)</td></tr>
		<for start="0" end="5">
		<tr>
		<td height="36">
		<input type="text" name="config[weight][<{$i}>][min]" value="<{$feeconfig['weight'][$i]['min']}>"  maxlength="25" />   </td>
		<td height="36">  
		<input type="text" name="config[weight][<{$i}>][max]" value="<{$feeconfig['weight'][$i]['max']}>"  maxlength="25" /> 
		</td>
		<td height="36">  
		<input type="text" name="config[weight][<{$i}>][money]" value="<{$feeconfig['weight'][$i]['money']}>"  maxlength="25" /> 
		</td>
		</tr>
		</for>
		</table>
	</div>
	
		<div style="padding:10px;"> <h3>地区</h3></div>
	<div class="vmall_cle" style="margin-left:30px;" >
		<table width="400" style="line-height:30px;">
		<tr><td height="24" >设置地区</td><td height="24">运费(元)</td></tr>
		<for start="0" end="8">
		<tr>
		 
		<td height="36">  
		<input type="hidden"  name="config[area][<{$i}>][area_id]"   id="config_area_id_<{$i}>"  value="<{$feeconfig['area'][$i]['area_id']}>"  maxlength="25" /> 
		<input type="text" readonly="true"  onclick="config_area_name('<{$i}>')" id="config_area_name_<{$i}>" name="config[area][<{$i}>][area_name]" value="<{$feeconfig['area'][$i]['area_name']}>"  maxlength="25" /> 
		</td>
		<td height="36">  
		<input type="text" name="config[area][<{$i}>][money]" value="<{$feeconfig['area'][$i]['money']}>"  maxlength="25" /> 
		</td>
		</tr>
		</for>
		</table>
	</div>
	<!--	<div style="padding:10px;"> <h3>优惠金额</h3></div>
			<div class="vmall_cle" style="margin-left:30px;" >
				<table width="400" style="line-height:30px;">
				<tr><td height="24">订单满</td><td height="24">优惠金额</td></tr>
				<for start="0" end="5">
				<tr>	 
				<td height="36">  
				<input type="text" name="config[money][<{$i}>][amount]" value="<{$feeconfig['money'][$i]['amount']}>"  maxlength="25" /> 
				</td>
				<td height="36">  
				<input type="text" name="config[money][<{$i}>][money]" value="<{$feeconfig['money'][$i]['money']}>"  maxlength="25" /> 
				</td>
				</tr>
				</for>
				</table>
			</div>-->
					
                      <div class="vmall_cle">
                                <div class="vmaal_rols">
                                    <button class="v_mall_q_1" style="border:0; height:32px; padding-top:0; width:200px;  cursor:pointer;" type="submit">保&nbsp;&nbsp;存</button>
                                </div>
                            </div>
                    	 
                     </form> 
                </div>
                
            </div>
            
            
            <!--弹窗 AD-->
            
         <div class="modal hide fade in"  id="guide_1" aria-hidden="false">
              <div class="modal-footer" style="text-align:left">  <div>请选择地区：
					<select id="select_p">
					<option>请选择...</option>
					<volist name="area" id="vo">
					<option value="<{$vo.area_id}>"><{$vo.area_name}></option>
					</volist>
					</select>
					<select  id="select_id">
					<option value="">请选择...</option>
					</select>
					 <button   onclick="add_area()" class="btn" style="padding:4px 12px; font-size:14px;">添加</button>
					 <button onclick="clean_area()"  class="btn" style="padding:4px 12px; font-size:14px;" >清除</button>
					</div></div>
			    <div class="modal-body" style="min-height:150px">
					 
					<div id="area_names"></div>
					<input type="hidden" id="area_ids" value=""  />
                </div>
                <div class="modal-footer">
                    <button aria-hidden="true" onclick="saveArea()" data-dismiss="modal" class="btn" style="padding:4px 12px; font-size:14px;">确定</button>
					 <button onclick="$('.modal').hide()" aria-hidden="true" data-dismiss="modal" class="btn" style="padding:4px 12px; font-size:14px;">关闭</button>
                </div>
            </div> 
            
            <!--弹窗 |End -->
        </div>
        
 
    
    
    <input type="hidden" id="config_area_name" />
  
</div>
<script>
 function config_area_name(i){
    $("#config_area_name").val(i);
	var area_name_str=$("#config_area_name_"+i).val();
	var area_id_str=$("#config_id_name_"+i).val();
	$("#area_ids").val(area_id_str);
	$("#area_names").html(area_name_str);
	$("#guide_1").show();
 }
 
 function clean_area(){
  $("#area_ids").val("");
  $("#area_names").html("");
 }
 /*******************/
 function add_area(){
	var id=$("#select_id").val();
	var text=$("#select_id option:selected").text();
	if(id==""){
	alert("请选择地区");
	return false;
	}
	area_ids= $("#area_ids").val()+","+id;
	area_names=  $("#area_names").html()+","+text;
	area_names=area_names.replace(/^\,*/, "");
	area_ids=area_ids.replace(/^\,*/, "");
	$("#area_ids").val(area_ids);
	$("#area_names").html(area_names);
 }
 
 function saveArea(){
	var area_name="config_area_name_"+$("#config_area_name").val();
	var area_id="config_area_id_"+$("#config_area_name").val();
	$("#"+area_name).val( $("#area_names").html());
	$("#"+area_id).val( $("#area_ids").val());
	$(".modal").hide();
 }
 
 $("#select_p").change(function(){
    var pid=$(this).val();
	$("#select_id").html("");
	$.getJSON("<{:U('city_area')}>",{pid:pid},function(data){
	   $.each(data,function(i,v){
	    var html='<option value="'+v.area_id+'">'+v.area_name+'</option>';
	      $("#select_id").append(html);
	   })
	})
 })
 
</script>


</body>
</html>
